package in.muton.edushare.grading.panels.gradeDisplay;

import in.muton.edushare.grading.panels.studentGrades.GradingUtil;
import in.muton.edushare.grading.panels.studentGrades.GradingUtil.CourseGradeHelper;
import in.muton.edushare.pages.common.EdusharePanel;
import in.muton.edushare.url.EduShareURLPanel;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;

import com.edushare.common.vo.CourseInstances;
import com.edushare.common.vo.Users;

public class CourseView extends EdusharePanel {
	private static final long serialVersionUID = 2897347879765851183L;

	public CourseView(String id, final IModel<Users> userModel,
			final IModel<CourseInstances> courseModel) {
		super(id, userModel);
		add(new Label("courseName", courseModel.getObject().getCourse().getCourseName()));
		add(new EduShareURLPanel("courseLink", courseModel).setUrlText(" (Home)"));
		CourseGradeHelper cg = new GradingUtil(courseModel)
			.getGrades(userModel.getObject());
		
		add(new Label("grade", cg.isLetterGrade?"Grade : "+ cg.temp : "Marks : "+cg.temp));
		add(new ItemView("itemView", userModel, courseModel));
	}
}
